import static org.junit.Assert.*;


import java.util.List;
import java.util.ArrayList;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class ScheduleTest {

   
	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testFCFS() {
		   Schedule sd = new Schedule();
		   Work a = new Work("p1", 0, 4);
		   Work b = new Work("p2", 1, 1);
		   List<Work> list = new ArrayList<Work>();
		   list.add(a);
		   list.add(b);
		   List<Double> list2 = new ArrayList<Double>();
		   list2.add(5.0);
		   list2.add(1.0);
		   assertEquals(list2, sd.FCFS(list));
	}
	@Test
	public void testSJF() {
		Schedule sd = new Schedule();
		   Work a = new Work("p1", 1, 1);
		   Work b = new Work("p2", 2,1);
		   List<Work> list = new ArrayList<Work>();
		   list.add(a);
		   list.add(b);
		   List<Double> list2 = new ArrayList<Double>();
		   list2.add(1.0);
		   list2.add(1.0);
		   assertEquals(list2, sd.SJF(list));
	}

	@Test
	public void testSortByServiceTime() {
		Schedule sd = new Schedule();
		   Work a = new Work("p1", 1,1);
		   Work b = new Work("p2", 2, 1);
		   List<Work> list = new ArrayList<Work>();
		   list.add(a);
		   list.add(b);
		   List<Double> list2 = new ArrayList<Double>();
		   list2.add(1.0);
		   list2.add(1.0);
		   assertEquals(list2, sd.sortByServiceTime(list));
	}


}
